package edu.fiu.accesslog;

import java.io.*;
import java.util.logging.*;

/**
 * Main/Init for the Utility only tomcat access log is supported. It's important
 * to use the same access format used in the access log & this Utility to get an
 * accurate output.
 *
 * @author Hasan Mahmud @date May 25, 2012
 */
public class AccessLogReader
{

        public AccessLogReader()
        {
//                File f=new File("HasanMyfile.txt");
//                try
//                {
//                        f.createNewFile();
//                }
//                catch (IOException ex)
//                {
//                        Logger.getLogger(AccessLogReader.class.getName()).log(Level.SEVERE, null, ex);
//                }
                System.out.println("######### Access Log Reader Started #############\n");

                String format = "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"";

                String logFileNames[] = new String[]
                {
                        "logs/access_log.1"
                     //   , "logs/access_log.2"
                ///, "logs/access_log.3"
                };

                LogInputReader rd = new LogInputReader(logFileNames, format, "preProcessedLog");
                rd.startReading();
                
                //RecordUtility.printArray(LogStatistics.getInstance().getFrequentVisitors(), "Frequent Visitors", 10);

        }
}
